package com.huatech.core.service;


import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.JSONObject;
import com.huatech.core.constant.Constant;
/**
 * socket组件抽象类
 * @author lh@erongdu.com
 * @since 2019年3月15日
 * @version 1.0
 *
 */
public abstract class AbstractComponent {
	
    public static final long MINUTE_IN_MILLIS = 60 * 1000;
    public static final long DAY_IN_MILLIS = 24 * 60 * MINUTE_IN_MILLIS;
    public static final long TIME_INTERVAL = 300;
	
	public String handler(JSONObject json){
		Object result = data(json);
		Map<String, Object> data = new HashMap<String, Object>();
		json.put(Constant.RESPONSE_CODE, "200");
        data.put(Constant.RESPONSE_DATA, result);
        data.put(Constant.APP_URL, json.get(Constant.APP_URL));
        data.put(Constant.APP_PARAM, json.get(Constant.APP_PARAM));
        return JSONObject.toJSONString(data);		
	}
	
	abstract Object data(JSONObject json);

}
